package org.litespring.core.io;

import org.litespring.util.Assert;
import org.litespring.util.ClassUtils;

import java.io.*;

/**
 * Created by tjc on 2019-2-8.
 */
public class FileSystemResource implements Resource {

    private String path;
    private final File file;

    public FileSystemResource(String path) {
        Assert.notNull(path, "Path must not be null");
        this.path = path;
        this.file = new File(path);
    }

    public InputStream getInputStream() throws IOException {
        return new FileInputStream(path);
    }

    public String getDescription() {
        return "file [" + this.file.getAbsolutePath() + "]";
    }
}
